var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
    return typeof t;
  } : function(t) {
    return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  },
  is_no_more = !1,
  is_loading_more = !1;

Page({
  data: {
    cat_list: [],
    sub_cat_list_scroll_top: 0,
    scrollLeft: 0,
    page: 1,
    cat_style: 0,
    height: 0,
    catheight: 120,
    current_8_index: 0,
    current_8_2_index: 0
  },
  onLoad: function(t) {
    var a = this;
    console.log(121);
    console.log(t);
    getApp().page.onLoad(a, t);
    this.systemInfo = getApp().core.getSystemInfoSync()
    var e = getApp().core.getStorageSync(getApp().const.STORE),
      o = t.cat_id ? t.cat_id : getApp().globalData.tab_cat_id;
      
    getApp().globalData.tab_cat_id = 0;
    void 0 !== o && o && (a.data.cat_style = e.cat_style = -1, getApp().core.showLoading({
      title: "正在加载",
      mask: !0
    }), a.childrenCat(o)), a.setData({
      store: e
    });

    -1 !== this.data.cat_style && this.loadData(getApp().globalData.cat_id);
  },
  onShow: function(t) {
    getApp().page.onShow(this), getApp().core.hideLoading();
    var e = getApp().core.getStorageSync(getApp().const.STORE);
    console.log(getApp().globalData.cat_id);
    getApp().globalData.cat_id==0?getApp().globalData.cat_id='':getApp().globalData.cat_id;
    if (this.data.cat_list.length > 0 && (e.cat_style == 4 || e.cat_style == 6 || e.cat_style == 5)) {
      var index = this.data.cat_list.findIndex(item => {
        return item.id == getApp().globalData.cat_id
      })
      if (index > -1) {
        console.log(1)
        if (e.cat_style == 4) {
          this.catItemClick({
            currentTarget: {
              dataset: {
                index: index
              }
            }
          })
        }
        
        if (e.cat_style == 6 || e.cat_style == 5) {
          this.goodsAll({
            currentTarget: {
              dataset: {
                index: index
              }
            }
          })
        }
      }
    }
  },
  loadData: function(cat_id) {
    var a = this;
    var e = getApp().core.getStorageSync(getApp().const.STORE);

    if (e.cat_style == 8) {
      getApp().core.showLoading({
        title: "正在加载",
        mask: !0
      })
      getApp().request({
        url: getApp().api.default.cat_list,
        success: function(res) {
          var arr = [{
            name:'全部',
            id:'',
            list: []
          }];
          var arrlist = arr.concat(t.data.list);
          if (res.code == 0) {
            a.setData({
              cat_list: arrlist
            })
           
            a.onClickLeftByEight2(0)
          }
        },
        complete: function () {
          getApp().core.hideLoading()
        }
      })
      return;
    }
    if ("" == a.data.cat_list || 5 != e.cat_style && 6 != e.cat_style && 4 != e.cat_style && 2 != e.cat_style && 7 != e.cat_style) {
      var o = getApp().core.getStorageSync(getApp().const.CAT_LIST);
      o && a.setData({
        cat_list: o,
        current_cat: null
      }), getApp().request({
        url: getApp().api.default.cat_list,
        success: function(t) {
          var arr = [{
            name:'全部',
            id:'',
            list: []
          }];
          var arrlist = arr.concat(t.data.list);
         
          if (0 == t.code) {
            a.data.cat_list = arrlist;
           
            if (5 === e.cat_style || 6 === e.cat_style) {

              var get_cat_id_index = 0;
          
              var get_cat_id_index = a.data.cat_list.findIndex(item => {
                return item.id == cat_id
              })
              a.goodsAll({
                currentTarget: {
                  dataset: {
                    index: get_cat_id_index
                  }
                }
              })
            }
           

            4 !== e.cat_style && 7 !== e.cat_style && 2 !== e.cat_style || a.catItemClick({
              currentTarget: {
                dataset: {
                  index: 0
                }
              }
            }), 
            1 !== e.cat_style && 3 !== e.cat_style || (a.setData({
              cat_list: t.data.list,
              current_cat: null
            }), getApp().core.setStorageSync(getApp().const.CAT_LIST, t.data.list))
          }
        },
        complete: function() {
          getApp().core.stopPullDownRefresh();
        }
      });
    } else a.setData({
      cat_list: a.data.cat_list,
      current_cat: a.data.current_cat
    });
  },
  // 分类样式8，点击顶部一级分类
  onClickLeftByEight: function (e) {
    var index = e.currentTarget.dataset.index
    this.setData({
      current_8_index: index
    })
    this.onClickLeftByEight2(0)
    var query = wx.createSelectorQuery();
    query.select('.cat-8-top').boundingClientRect((res) => {
      var scrollWidth = Math.round(res.width);
      var offsetLeft = e.currentTarget.offsetLeft
      this.setData({
        scrollLeft: offsetLeft - scrollWidth / 2
      })
    }).exec();
  },
  //分类样式8，点击左侧二级分类
  onClickLeftByEight2: function (e) {
    var index = e.currentTarget ? e.currentTarget.dataset.index : e
    if (this.data.cat_list[this.data.current_8_index].list.length == 0) {
      return
    }
    this.setData({
      current_8_2_index: index,
      page: 1
    })
    var cat_id = this.data.cat_list[this.data.current_8_index].list[index].id
    this.list(cat_id, 2)
  },
  childrenCat: function(i) {
    var s = this;
    is_no_more = !1;
    s.data.page;
    getApp().request({
      url: getApp().api.default.cat_list,
      success: function(t) {
        if (0 == t.code) {
          var a = !0;
          var arr = [{
            name:'全部',
            id:'',
            list: []
          }];
          t.data.list = arr.concat(t.data.list);
          for (var e in t.data.list)
            for (var o in t.data.list[e].id == i && (a = !1, s.data.current_cat = t.data.list[e],
                0 < t.data.list[e].list.length ? (s.setData({
                  catheight: 100
                }), s.firstcat({
                  currentTarget: {
                    dataset: {
                      index: 0
                    }
                  }
                })) : s.firstcat({
                  currentTarget: {
                    dataset: {
                      index: 0
                    }
                  }
                }, !1)), t.data.list[e].list) t.data.list[e].list[o].id == i && (a = !1, s.data.current_cat = t.data.list[e],
              s.goodsItem({
                currentTarget: {
                  dataset: {
                    index: o
                  }
                }
              }, !1));
          a && s.setData({
            show_no_data_tip: !0
          });
        }
      },
      complete: function() {
        getApp().core.stopPullDownRefresh(), getApp().core.createSelectorQuery().select("#cat").boundingClientRect().exec(function(t) {
          s.setData({
            height: t[0].height
          });
        });
      }
    });
  },
  catItemClick: function(t) {
    var a = t.currentTarget.dataset.index,
      e = this.data.cat_list,
      o = null;
    for (var i in e) i == a ? (!(e[i].active = !0), o = e[i]) : e[i].active = !1;
    this.setData({
      cat_list: e,
      sub_cat_list_scroll_top: 0,
      current_cat: o
    });
  },
  firstcat: function(t) {
    var a = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1],
      e = this,
      o = e.data.current_cat;
    e.setData({
      page: 1,
      goods_list: [],
      show_no_data_tip: !1,
      current_cat: a ? o : []
    }), e.list(o.id, 2);
  },
  goodsItem: function(t) {
    var a = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1],
      e = this,
      o = t.currentTarget.dataset.index,
      i = e.data.current_cat,
      s = 0;
    for (var c in i.list) o == c ? (i.list[c].active = !0, s = i.list[c].id) : i.list[c].active = !1;
    e.setData({
      page: 1,
      goods_list: [],
      show_no_data_tip: !1,
      current_cat: a ? i : []
    }), e.list(s, 2);
  },
/*
  goodsAll: function(o) {
    var i = this,
      t = o.currentTarget.dataset.index,
      s = i.data.cat_list,
      a = null;
    for (var e in s) e == t ? (s[e].active = !0, a = s[e]) : s[e].active = !1;
    if (i.setData({
        page: 1,
        goods_list: [],
        show_no_data_tip: !1,
        cat_list: s,
        current_cat: a
      }), void 0 === ("undefined" == typeof my ? "undefined" : _typeof(my))) {
      var c = o.currentTarget.offsetLeft,
        n = i.data.scrollLeft;
      n = c - 80, i.setData({
        scrollLeft: n
      });
    } else s.forEach(function(t, a, e) {
      t.id == o.currentTarget.id && (1 <= a ? i.setData({
        toView: s[a - 1].id
      }) : i.setData({
        toView: s[a].id
      }));
    });
    i.list(a.id, 1), getApp().core.createSelectorQuery().select("#catall").boundingClientRect().exec(function(t) {
      i.setData({
        height: t[0].height
      });
    });
  },
  */
  goodsAll: function (a) {
    var e = this,
      s = a.currentTarget.dataset.index==-1?0:a.currentTarget.dataset.index,
      i = e.data.cat_list,
      c = null;
      
    for (var o in i) o == s ? (i[o].active = !0, c = i[o]) : i[o].active = !1;
    console.log(s,i)
    if (c != null) {
      for (var cc in c.list) c.list[cc].active = !1;
    }
    if (e.setData({
      page: 1,
      goods_list: [],
      show_no_data_tip: !1,
      cat_list: i,
      current_cat: c
    }), void 0 === ("undefined" == typeof my ? "undefined" : t(my))) {
      var r = a.currentTarget.offsetLeft,
        n = e.data.scrollLeft;
      n = r - 80, e.setData({
        scrollLeft: n
      });
    } else i.forEach(function (t, s, c) {
      t.id == a.currentTarget.id && (s >= 1 ? e.setData({
        toView: 'id_' + i[s - 1].id
      }) : e.setData({
        toView: 'id_' + i[s].id
      }));
    });
    console.log(c)
    this.list(c.id, 1), wx.createSelectorQuery().select("#catall").boundingClientRect().exec(function (t) {
      e.setData({
        height: t[0].height
      });
    });
    this.setData({
      is_sroll: 1,
      select_cat_info: c,
      select_index: s,
      default_select: 1
    })
    this.switchNav(a)
  },
  goodsAllSix: function (a) {
    if (this.data.page > this.data.page_count) {
      this.setData({
        is_sroll: 0,
      })
    } else {
      this.loadMoreGoodsList(a)
    }
  },
  list: function(a, t) {
    var e = this;
    getApp().core.showLoading({
      title: "正在加载",
      mask: !0
    }), is_no_more = !1;
    var o = e.data.page || 2;
    getApp().request({
      url: getApp().api.default.goods_list,
      data: {
        cat_id: a,
        page: o
      },
      success: function(t) {
        0 == t.code && (getApp().core.hideLoading(), 0 == t.data.list.length && (is_no_more = !0),
          e.setData({
            page: o + 1
          }), e.setData({
            goods_list: t.data.list
          }), e.setData({
            cat_id: a
          })), e.setData({
          show_no_data_tip: 0 == e.data.goods_list.length
        });
      },
      complete: function() {
        1 == t && getApp().core.createSelectorQuery().select("#catall").boundingClientRect().exec(function(t) {
          e.setData({
            height: t[0].height
          });
        });
      }
    });
  },
  onReachBottom: function() {
    getApp().page.onReachBottom(this);
    is_no_more || 5 != getApp().core.getStorageSync(getApp().const.STORE).cat_style && -1 != this.data.cat_style || this.loadMoreGoodsList();
  },
  loadMoreGoodsList: function() {
    var e = this;
    if (!is_loading_more) {
      e.setData({
        show_loading_bar: !0
      }), is_loading_more = !0;
      var t = e.data.cat_id || "",
        o = e.data.page || 2;
      var shop_id = wx.getStorageSync('address_info').shop_id
      getApp().request({
        url: getApp().api.default.goods_list,
        data: {
          page: o,
          cat_id: t,
          shop_id: shop_id
        },
        success: function(t) {
          0 == t.data.list.length && (is_no_more = !0);
          var a = e.data.goods_list.concat(t.data.list);
          e.setData({
            goods_list: a,
            page: o + 1,
            page_count: t.data.page_count
          });
        },
        complete: function() {
          is_loading_more = !1, e.setData({
            show_loading_bar: !1
          });
        }
      });
    }
  },
  /*
  loadMoreGoodsList: function () {
    var t = this;
    if (!i) {
      t.setData({
        show_loading_bar: !0
      }), i = !0;
      var c = t.data.cat_id || "",
        o = t.data.page || 2;
      var shop_id = wx.getStorageSync('address_info').shop_id
      e.request({
        url: a.default.goods_list,
        data: {
          page: o,
          cat_id: c,
          shop_id: shop_id
        },
        success: function (a) {
          0 == a.data.list.length && (s = !0);
          var e = t.data.goods_list.concat(a.data.list);
          t.setData({
            goods_list: e,
            page: o + 1
          });
        },
        complete: function () {
          i = !1, t.setData({
            show_loading_bar: !1
          });
        }
      });
    }
  },
*/
  //新分类js
  //事件处理函数
  switchRightTab: function (e) {
    var index = e.currentTarget.dataset.index;
    var singleNavHight = this.data.windowHeight / 20;
    this.setData({
      curIndex: index,
      navScrollTop: (index - 2) * singleNavHight
    })
  },
  closelayout: function () {

    this.setData({
      islayout: false,
      islayoutbox: false,
      islayoutimg: true
    })
  },
  openlayout: function () {
    this.setData({
      islayout: !this.data.islayout,
      islayoutbox: !this.data.islayoutbox,
      islayoutimg: !this.data.islayoutimg
    })
  },

  //footerTap: app.footerTap,
  switchNav(event) {

    var cur = event.currentTarget.dataset.index;
    cur = cur < 0 ? 0 : cur++;
    //每个tab选项宽度占1/5
    var singleNavWidth = 70;
    //tab选项居中                            
    this.setData({
      navScrollLeft: (cur - 1) * singleNavWidth + 40
    })
  },
  switchTab(event) {
    var cur = event.detail.current;
    var singleNavWidth = this.data.windowWidth / 5;
    this.setData({
      currentTab: cur,
      navScrollLeft: (cur - 2) * singleNavWidth
    });
  },

  jia: function (t) {
    if (!wx.getStorageSync(getApp().const.USER_INFO) || wx.getStorageSync(getApp().const.USER_INFO).length == 0) {
      this.setData({
        user_info_show: !0
      })
      return false;
    }
    var that = this,
      // o = t.currentTarget.dataset,
      r = that.data.goods_list;

    // var goods_index = t.currentTarget.dataset.index;
    var goods_id = t.currentTarget.dataset.id;
    // var goods_cid = t.currentTarget.dataset.cid;
    for (var s in r)
      if (parseInt(r[s].id) === parseInt(goods_id)) {
        // var ee = r[s].c_num ? r[s].c_num + 1 : 1;
        // if (ee > r[s].num) {
        //   wx.showToast({
        //     title: '商品库存不足',
        //     icon: 'none'
        //   });
        //   return;
        // }
        if (r[s].id == goods_id) {
          var ss = s;
          wx.showLoading({
            title: "加载中"
          });
          getApp().request({
            url: getApp().api.cart.add_cart,
            method: "POST",
            data: {
              goods_id: parseInt(r[s].id),
              attr: '[{"attr_group_id":1,"attr_id":1}]',
              num: 1
            },
            success: function (t) {
              wx.hideLoading();
              if (t.code == 0) {
                if (r[ss].c_num) {
                  r[ss].c_num++;
                } else {
                  r[ss].c_num = 1;
                }
                that.setData({
                  goods_list: r
                });
              } else {
                wx.showToast({
                  icon: 'none',
                  title: t.msg,
                  duration: 1500
                })
              }
              // that.cart_num();
            },
            complete: function (res) {
              wx.hideLoading()
            }
          })
        }
      }

    getApp().page.updateCartNum(1)
  },
  jian: function (t) {
    var that = this,
      // o = t.currentTarget.dataset,
      r = that.data.goods_list;
    // var goods_index = t.currentTarget.dataset.index;
    var goods_id = t.currentTarget.dataset.id;
    // var goods_cid = t.currentTarget.dataset.cid;

    for (var s in r)
      if (r[s].id == goods_id) {
        // if (r[s].id == goods_id) {
          // var ii = i,
          var ss = s;
          wx.showLoading({
            title: "加载中"
          })
          getApp().request({
            url: getApp().api.default.cart_reduce,
            data: {
              goods_id: parseInt(r[s].id),
            },
            success: function (t) {
              if (t.code == 0) {
                r[ss].c_num--;
                that.setData({
                  goods_list: r
                });
              } else {
                wx.showToast({
                  icon: 'none',
                  title: t.msg,
                  duration: 1000
                })
              }
              // that.cart_num();
            },
            complete: function () {
              wx.hideLoading();
            }
          })
        // }
      }
    
      getApp().page.updateCartNum(1)
  },
  showDialogBtn: function (o) {
    if (!wx.getStorageSync(getApp().const.USER_INFO) || wx.getStorageSync(getApp().const.USER_INFO).length == 0) {
      this.setData({
        user_info_show: !0
      })
      return false;
    }
    var r = this,
      i = o.currentTarget.dataset,
      goods_id = o.currentTarget.dataset.id;
    wx.showLoading({
      title: "加载中"
    })
    getApp().request({
      url: getApp().api.default.goods,
      data: {
        id: goods_id
      },
      success: function (t) {
        wx.hideLoading()
        0 == t.code && (r.setData({
          currentGood: t.data,
          goods_name: t.data.name,
          attr_group_list: t.data.attr_group_list,
          showModal: !0
        }), r.resetData(), r.updateData());
      },
      complete: function () {
        wx.hideLoading()
      }
    });
  },
  attrClick: function (t) {
    var a = this,
      o = t.target.dataset.groupId,
      r = t.target.dataset.id,
      i = a.data.attr_group_list,
      s = a.data.currentGood;
    for (var e in i)
      if (i[e].attr_group_id == o)
        for (var d in i[e].attr_list) i[e].attr_list[d].attr_id == r ? i[e].attr_list[d].checked = !0 : i[e].attr_list[d].checked = !1;
    var c = [];
    for (var e in i)
      for (var d in i[e].attr_list) !0 === i[e].attr_list[d].checked && c.push([i[e].attr_list[d].attr_id, s.id]);
    var n = JSON.parse(a.data.currentGood.attr),
      u = a.data.temporaryGood;
    for (var _ in n) {
      var g = [];
      for (var l in n[_].attr_list) g.push([n[_].attr_list[l].attr_id, s.id]);
      if (g.sort().join() === c.sort().join()) {
        if (0 === parseInt(n[_].num)) return void wx.showToast({
          title: "商品库存不足",
          image: "/images/icon-warning.png"
        });
        u = parseFloat(n[_].price) ? {
          price: n[_].price.toFixed(2)
        } : {
            price: s.price.toFixed(2)
          };
      }
    }
    a.resetData(), a.checkUpdateData(c), a.setData({
      attr_group_list: i,
      temporaryGood: u,
      checked_attr: c
    });
  },
  resetData: function () {
    this.setData({
      checked_attr: [],
      check_num: 0,
      check_goods_price: 0,
      temporaryGood: {
        price: "0.00"
      }
    });
  },
  checkUpdateData: function (t) {
    var a = this,
      o = a.data.carGoods;
    for (var r in o) {
      var i = [];
      for (var s in o[r].attr) i.push([o[r].attr[s].attr_id, o[r].goods_id]);
      i.sort().join() === t.sort().join() && a.setData({
        check_num: o[r].num,
        check_goods_price: o[r].goods_price
      });
    }
  },
  onConfirm: function (t) {
    var a = this,
      o = a.data.attr_group_list,
      r = a.data.checked_attr,
      i = a.data.currentGood;
    if (r.length === o.length) {
      var s = a.data.check_num ? a.data.check_num + 1 : 1,
        e = JSON.parse(i.attr);
      for (var d in e) {
        var c = [];
        for (var n in e[d].attr_list)
          if (c.push([e[d].attr_list[n].attr_id, i.id]), c.sort().join() === r.sort().join()) {
            var u = e[d].price ? e[d].price : i.price,
              _ = e[d].attr_list;
            if (s > e[d].num) return void wx.showToast({
              title: "商品库存不足",
              image: "/images/icon-warning.png"
            });
          }
      }

      for (var ii in o) {
        for (var kk in o[ii].attr_list) {
          if (o[ii].attr_list[kk].checked) {
            o[ii].attr_id = o[ii].attr_list[kk].attr_id;
            o[ii].attr_name = o[ii].attr_list[kk].attr_name;
          }
        }
        delete o[ii].attr_list;
      }
      wx.showLoading({
        title: '加载中',
      })
      getApp().request({
        url: getApp().api.cart.add_cart,
        method: "POST",
        data: {
          goods_id: i.id,
          attr: JSON.stringify(o),
          num: 1
        },
        success: function (t) {
          if (t.code == 0) {
            wx.showToast({
              title: t.msg,
              duration: 1500
            });
            // a.cart_num()
          }
        },
        complete: function () {
          wx.hideLoading()
        }
      })

      var g = a.data.carGoods,
        l = 1,
        h = (parseFloat(u) * s).toFixed(2);
      for (var p in g) {
        var f = [];
        for (var v in g[p].attr) f.push([g[p].attr[v].attr_id, g[p].goods_id]);
        if (f.sort().join() === r.sort().join()) {
          l = 0, g[p].num = g[p].num + 1, g[p].goods_price = (parseFloat(u) * g[p].num).toFixed(2);
          break;
        }
      }
      getApp().page.updateCartNum(1)
      a.hideGoodsModel();
    } else wx.showToast({
      title: "请选择规格",
      image: "/images/icon-warning.png"
    });
  },
  updateData: function () {
    var t = this,
      a = t.data.currentGood,
      o = t.data.carGoods,
      r = JSON.parse(a.attr),
      i = a.attr_group_list;
    for (var s in r) {
      var e = [];
      for (var d in r[s].attr_list) e.push([r[s].attr_list[d].attr_id, a.id]);
      for (var c in o) {
        var n = [];
        for (var u in o[c].attr) n.push([o[c].attr[u].attr_id, o[c].goods_id]);
        if (e.sort().join() === n.sort().join()) {
          for (var _ in i)
            for (var g in i[_].attr_list)
              for (var l in e) {
                if (parseInt(i[_].attr_list[g].attr_id) === parseInt(e[l])) {
                  i[_].attr_list[g].checked = !0;
                  break;
                }
                i[_].attr_list[g].checked = !1;
              }
          var h = {
            price: o[c].price
          };
          return void t.setData({
            attr_group_list: i,
            check_num: o[c].num,
            check_goods_price: o[c].goods_price,
            checked_attr: e,
            temporaryGood: h
          });
        }
      }
    }
  },
  hideGoodsModel: function () {
    this.setData({
      showModal: !1
    });
  },
  close_box: function (t) {
    this.setData({
      showModal: !1
    });
  },

  //手指触摸动作开始 记录起点X坐标
  touchstart: function (e) {
    if (this.data.is_sroll == 1) return false;
    this.setData({
      startX: e.changedTouches[0].clientX,
      startY: e.changedTouches[0].clientY,
    })
  },
  //手指结束 记录起点X坐标
  touchend: function (e) {
    this.setData({ translateY: 0 })
    if (this.data.is_sroll == 1) return false;
    if (this.data.select_index + 1 == this.data.cat_list.length) return false;
    if (this.data.translate_loade == 0) return false;
    var that = this;
    var endX = e.changedTouches[0].clientX;
    var endY = e.changedTouches[0].clientY;
    var startY = that.data.startY;

    if (startY - endY >= 150 && startY > 0) {
      that.setData({
        is_sroll: 1,
        translateY: 0,
        translate_loade: 0
      })
      var cat_list = this.data.cat_list;
      var ii_index = 0;
      var cat_id = 0;
      for (var ii in cat_list) {
        if (cat_list[ii].active) {
          ii_index = ii;
          cat_id = cat_list[ii].id
        }
      }
      if (ii_index >= cat_list.length) {

      } else {
        that.goodsAll({
          currentTarget: {
            dataset: {
              index: ++ii_index,
              id: cat_id
            },
            id: cat_id
          }
        })
      }
    } else {
      this.setData({
        translateY: 0,
        translate_loade: 0
      })
    }
  },
  touchmove: function (e) {
    if (this.data.is_sroll == 1) return false;
    if (this.data.select_index + 1 == this.data.cat_list.length) return false;
    var that = this;
    var startX = that.data.startX; //开始X坐标
    var startY = that.data.startY; //开始Y坐标
    var touchMoveX = e.changedTouches[0].clientX; //滑动变化坐标
    var touchMoveY = e.changedTouches[0].clientY; //滑动变化坐标
    if (startY - touchMoveY <= 150 && startY > 0) {
      this.setData({
        translateY: startY - touchMoveY,
      })
    } else {
      this.setData({
        translate_loade: 1
      })
    }
    // if (startY - touchMoveY >= 120 && startY > 0) {
    //   that.setData({
    //     is_sroll: 1
    //   })
    //   var cat_list = this.data.cat_list;
    //   var ii_index = 0;
    //   var cat_id = 0;
    //   for (var ii in cat_list) {
    //     if (cat_list[ii].active) {
    //       ii_index = ii;
    //       cat_id = cat_list[ii].id
    //     }
    //   }
    //   if (ii_index >= cat_list.length) {

    //   } else {
    //     that.goodsAll({
    //       currentTarget: {
    //         dataset: {
    //           index: ++ii_index,
    //           id: cat_id
    //         },
    //         id: cat_id
    //       }
    //     })
    //   }
    // }
  },
  get_goods_info: function (t) {
    var a = this,
      o = a.data.carGoods,
      r = a.data.total,
      i = a.data.quick_hot_goods_lists,
      s = a.data.quick_list,
      e = {
        carGoods: o,
        total: r,
        quick_hot_goods_lists: i,
        check_num: a.data.check_num,
        quick_list: s
      };
    wx.setStorageSync("item", e);
    var d = t.currentTarget.dataset.id;
    wx.navigateTo({
      url: "/pages/goods/goods?id=" + d
    });
  },
  hexToRgb: function (hex) {
    var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
    return result ? {
      r: parseInt(result[1], 16),
      g: parseInt(result[2], 16),
      b: parseInt(result[3], 16)
    } : null;
  }
});